/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package origendatos.dyd.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author erodrig
 */
@Entity
@Table(name = "CARACTERISTICAS_PJ")
@NamedQueries({
    @NamedQuery(name = "CaracteristicasPj.findAll", query = "SELECT c FROM CaracteristicasPj c"),
    @NamedQuery(name = "CaracteristicasPj.findByIdPj", query = "SELECT c FROM CaracteristicasPj c WHERE c.caracteristicasPjPK.idPj = :idPj"),
    @NamedQuery(name = "CaracteristicasPj.findByIdCaracteristica", query = "SELECT c FROM CaracteristicasPj c WHERE c.caracteristicasPjPK.idCaracteristica = :idCaracteristica"),
    @NamedQuery(name = "CaracteristicasPj.findByPTemp", query = "SELECT c FROM CaracteristicasPj c WHERE c.pTemp = :pTemp"),
    @NamedQuery(name = "CaracteristicasPj.findByMTemp", query = "SELECT c FROM CaracteristicasPj c WHERE c.mTemp = :mTemp"),
    @NamedQuery(name = "CaracteristicasPj.findByPuntos", query = "SELECT c FROM CaracteristicasPj c WHERE c.puntos = :puntos"),
    @NamedQuery(name = "CaracteristicasPj.findByModificador", query = "SELECT c FROM CaracteristicasPj c WHERE c.modificador = :modificador")})
public class CaracteristicasPj implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CaracteristicasPjPK caracteristicasPjPK;
    @Column(name = "P_TEMP")
    private Integer pTemp;
    @Column(name = "M_TEMP")
    private Integer mTemp;
    @Column(name = "PUNTOS")
    private Integer puntos;
    @Column(name = "MODIFICADOR")
    private Integer modificador;
    @JoinColumn(name = "ID_PJ", referencedColumnName = "ID", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Pj pj;
    @JoinColumn(name = "ID_CARACTERISTICA", referencedColumnName = "ABREVIATURA", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Caracteristicas caracteristicas;

    public CaracteristicasPj() {
    }

    public CaracteristicasPj(CaracteristicasPjPK caracteristicasPjPK) {
        this.caracteristicasPjPK = caracteristicasPjPK;
    }

    public CaracteristicasPj(int idPj, String idCaracteristica) {
        this.caracteristicasPjPK = new CaracteristicasPjPK(idPj, idCaracteristica);
    }

    public CaracteristicasPjPK getCaracteristicasPjPK() {
        return caracteristicasPjPK;
    }

    public void setCaracteristicasPjPK(CaracteristicasPjPK caracteristicasPjPK) {
        this.caracteristicasPjPK = caracteristicasPjPK;
    }

    public Integer getPTemp() {
        return pTemp;
    }

    public void setPTemp(Integer pTemp) {
        this.pTemp = pTemp;
    }

    public Integer getMTemp() {
        return mTemp;
    }

    public void setMTemp(Integer mTemp) {
        this.mTemp = mTemp;
    }

    public Integer getPuntos() {
        return puntos;
    }

    public void setPuntos(Integer puntos) {
        this.puntos = puntos;
    }

    public Integer getModificador() {
        return modificador;
    }

    public void setModificador(Integer modificador) {
        this.modificador = modificador;
    }

    public Pj getPj() {
        return pj;
    }

    public void setPj(Pj pj) {
        this.pj = pj;
    }

    public Caracteristicas getCaracteristicas() {
        return caracteristicas;
    }

    public void setCaracteristicas(Caracteristicas caracteristicas) {
        this.caracteristicas = caracteristicas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (caracteristicasPjPK != null ? caracteristicasPjPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CaracteristicasPj)) {
            return false;
        }
        CaracteristicasPj other = (CaracteristicasPj) object;
        if ((this.caracteristicasPjPK == null && other.caracteristicasPjPK != null) || (this.caracteristicasPjPK != null && !this.caracteristicasPjPK.equals(other.caracteristicasPjPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "origendatos.dyd.model.CaracteristicasPj[caracteristicasPjPK=" + caracteristicasPjPK + "]";
    }

}
